﻿using Furion;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WeChatV3Pay.Application.Refunds.Dtos
{
    public class RefundsReq : RefundsDto
    {
        /// <summary>
        /// 证书私钥
        /// </summary>
        public string PrivateKey { get; set; }

        /// <summary>
        /// 证书编号
        /// </summary>
        public string SerialNo { get; set; }

        /// <summary>
        /// 商户号
        /// </summary>
        public string Mchid { get; set; }


        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (string.IsNullOrWhiteSpace(PrivateKey))
            {
                throw Oops.Oh(ErrorCodes.PRIVATE_KEY_IS_NULL);
            }
            if (string.IsNullOrWhiteSpace(SerialNo))
            {
                throw Oops.Oh(ErrorCodes.SERIAL_NO_IS_NULL);
            }
            yield return new ValidationResult("");
        }
    }
}
